package org.javaboy.dynamic_datasource.ds;

/**
 * ThreadLocal 在哪个线程存，必须哪个线程读取
 */
public class DynamicDataSourceContextHolder {
    private static final ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<>();

    public static void setDataSource(String name) {
        THREAD_LOCAL.set(name);
    }

    public static String getDataSource() {
        return THREAD_LOCAL.get();
    }

    public static void remove() {
        THREAD_LOCAL.remove();
    }
}
